#include "zsocket.h"
#include <unistd.h>
#include <fcntl.h>

int zsocket_stasetnonblock(int socketfd)
{
    int opts;
    opts = fcntl(socketfd, F_GETFL);
    if(opts < 0)
    {
        return -1;
    }
    opts |= O_NONBLOCK;
    if(fcntl(socketfd, F_SETFL, opts) < 0)
    {
        return -1;
    }
    return 0;
}
